QString get_cache_icon(const Waypoint* waypointp);
QString gs_get_cachetype(geocache_type t);
QString gs_get_container(geocache_container t);
-QString xml_entitize(const QString& str);
+[[deprecated("Use xmlstreamwriter.")]] QString xml_entitize(const QString& str);
QString html_entitize(const QString& str);
QString strip_html(const utf_string*);
QString strip_nastyhtml(const QString& in);
*/
-#include <cstring> // for strlen, strchr, strcmp
+#include <cstring> // for strlen, strchr, st
-#include <QByteArray> // for QByteArray
-#include <QHash> // for QHash
-#include <QLatin1String> // for QLatin1String
-#include <QPair> // for QPair, operator==
-#include <QString> // for QString, operator==, operator+
-#include <QXmlStreamAttributes> // for QXmlStreamAttributes
-#include <QtGlobal> // for qPrintable, QAddConst<>::Type
+#include <QByteArray> // for QByteArray
+#include <QIODevice> // for operator|, QIODevice, QIODevice::Text, QIODevice::WriteOnly
+#include <QLatin1String> // for QLatin1String
+#include <QPair> // for QPair, operator==
+#include <QString> // for QString, operator==, operator+
+#include <QXmlStreamAttributes> // for QXmlStreamAttributes
+#include <QtGlobal> // for qMax, qPrintable
#include "defs.h"
#include "osm.h"
-#include "gbfile.h" // for gbfprintf, gbfclose, gbfopen
-#include "src/core/datetime.h" // for DateTime
-#include "xmlgeneric.h" // for xg_string, build_xg_tag_map, xml_deinit, xml_init, xml_read
+#include "src/core/datetime.h" // for DateTime
+#include "src/core/xmlstreamwriter.h" // for XmlStreamWriter
+#include "xmlgeneric.h" // for xg_string, build_xg_tag_map, xml_deinit, xml_init, xml_read
#define MYNAME "osm"
OsmFormat::osm_write_tag(const QString& key, const QString& value) const
{
if (!value.isEmpty()) {
- gbfputs(QStringLiteral(" <tag k='%1' v='%2'/>\n")
- .arg(key, xml_entitize(value)),
- fout);
+ fout->writeEmptyElement(QStringLiteral("tag"));
+ fout->writeAttribute(QStringLiteral("k"), key);
+ fout->writeAttribute(QStringLiteral("v"), value);
}
}
}
void
-OsmFormat::osm_write_opt_tag(const char* atag)
+OsmFormat::osm_write_opt_tag(const QString& atag)
{
- char* cin;
-
- if (!atag) {
- return;
- }
-
- char* tag = cin = xstrdup(atag);
- char* ce = cin + strlen(cin);
-
- while (cin < ce) {
- char* sc, *dp;
-
- if ((sc = strchr(cin, ';'))) {
- *sc = '\0';
+ const QStringList tags = atag.split(';');
+ for (const auto& tag : tags) {
+ auto idx = tag.indexOf(':');
+ if (idx >= 0) {
+ osm_write_tag(tag.left(idx), tag.mid(idx+1));
}
-
- if ((dp = strchr(cin, ':'))) {
- *dp++ = '\0';
- osm_write_tag(cin, dp);
- }
- cin += strlen(cin) + 1;
}
-
- xfree(tag);
}
void
*id = --node_id;
const_cast<Waypoint*>(waypoint)->extra_data = id;
- gbfprintf(fout, " <node id='%d' visible='true' lat='%0.7f' lon='%0.7f'", *id, waypoint->latitude, waypoint->longitude);
+ fout->writeStartElement(QStringLiteral("node"));
+ fout->writeAttribute(QStringLiteral("id"), QString::number(*id));
+ fout->writeAttribute(QStringLiteral("visible"), QStringLiteral("true"));
+ fout->writeAttribute(QStringLiteral("lat"), QString::number(waypoint->latitude, 'f', 7));
+ fout->writeAttribute(QStringLiteral("lon"), QString::number(waypoint->longitude, 'f', 7));
if (waypoint->creation_time.isValid()) {
- QString time_string = waypoint->CreationTimeXML();
- gbfprintf(fout, " timestamp='%s'", qPrintable(time_string));
+ fout->writeAttribute(QStringLiteral("timestamp"), waypoint->CreationTimeXML());
}
- gbfprintf(fout, ">\n");
if (waypoint->hdop) {
- gbfprintf(fout, " <tag k='gps:hdop' v='%f' />\n", waypoint->hdop);
+ osm_write_tag(QStringLiteral("gps:hdop"), QString::number(waypoint->hdop, 'f'));
}
if (waypoint->vdop) {
- gbfprintf(fout, " <tag k='gps:vdop' v='%f' />\n", waypoint->vdop);
+ osm_write_tag(QStringLiteral("gps:vdop"), QString::number(waypoint->vdop, 'f'));
}
if (waypoint->pdop) {
- gbfprintf(fout, " <tag k='gps:pdop' v='%f' />\n", waypoint->pdop);
+ osm_write_tag(QStringLiteral("gps:pdop"), QString::number(waypoint->pdop, 'f'));
}
if (waypoint->sat > 0) {
- gbfprintf(fout, " <tag k='gps:sat' v='%d' />\n", waypoint->sat);
+ osm_write_tag(QStringLiteral("gps:sat"), QString::number(waypoint->sat));
}
switch (waypoint->fix) {
case fix_2d:
- gbfprintf(fout, " <tag k='gps:fix' v='2d' />\n");
+ osm_write_tag(QStringLiteral("gps:fix"), QStringLiteral("2d"));
break;
case fix_3d:
- gbfprintf(fout, " <tag k='gps:fix' v='3d' />\n");
+ osm_write_tag(QStringLiteral("gps:fix"), QStringLiteral("3d"));
break;
case fix_dgps:
- gbfprintf(fout, " <tag k='gps:fix' v='dgps' />\n");
+ osm_write_tag(QStringLiteral("gps:fix"), QStringLiteral("dgps"));
break;
case fix_pps:
- gbfprintf(fout, " <tag k='gps:fix' v='pps' />\n");
+ osm_write_tag(QStringLiteral("gps:fix"), QStringLiteral("pps"));
break;
case fix_none:
- gbfprintf(fout, " <tag k='gps:fix' v='none' />\n");
+ osm_write_tag(QStringLiteral("gps:fix"), QStringLiteral("none"));
break;
case fix_unknown:
default:
}
if (strlen(created_by) !=0) {
- gbfprintf(fout, " <tag k='created_by' v='%s",created_by);
- if (!gpsbabel_testmode())
+ QString value(created_by);
+ if (!gpsbabel_testmode()) {
if (strcmp("GPSBabel",created_by)==0) {
- gbfprintf(fout, "-%s", gpsbabel_version);
+ value += '-';
+ value += gpsbabel_version;
}
- gbfprintf(fout, "'/>\n");
+ }
+ osm_write_tag(QStringLiteral("created_by"), value);
}
osm_write_tag("name", waypoint->shortname);
osm_write_opt_tag(opt_tagnd);
- gbfprintf(fout, " </node>\n");
+ fout->writeEndElement(); // node
}
void
return;
}
- gbfprintf(fout, " <way id='%d' visible='true'>\n", --node_id);
+ fout->writeStartElement(QStringLiteral("way"));
+ fout->writeAttribute(QStringLiteral("id"), QString::number(--node_id));
+ fout->writeAttribute(QStringLiteral("visible"), QStringLiteral("true"));
}
void
if (waypoints.contains(name)) {
const Waypoint* waypoint = waypoints.value(name);
auto* id = static_cast<int*>(waypoint->extra_data);
- gbfprintf(fout, " <nd ref='%d'/>\n", *id);
+ fout->writeEmptyElement(QStringLiteral("nd"));
+ fout->writeAttribute(QStringLiteral("ref"), QString::number(*id));
}
}
}
if (strlen(created_by) !=0) {
- gbfprintf(fout, " <tag k='created_by' v='%s",created_by);
- if (!gpsbabel_testmode())
+ QString value(created_by);
+ if (!gpsbabel_testmode()) {
if (strcmp("GPSBabel",created_by)==0) {
- gbfprintf(fout, "-%s", gpsbabel_version);
+ value += '-';
+ value += gpsbabel_version;
}
- gbfprintf(fout, "'/>\n");
+ }
+ osm_write_tag(QStringLiteral("created_by"), value);
}
osm_write_tag("name", route->rte_name);
osm_write_opt_tag(opt_tag);
}
- gbfprintf(fout, " </way>\n");
+ fout->writeEndElement(); // way
}
/*-----------------------------------------------------------------------------*/
void
OsmFormat::wr_init(const QString& fname)
{
- fout = gbfopen(fname, "w", MYNAME);
+ ofile = new gpsbabel::File(fname);
+ ofile->open(QIODevice::WriteOnly | QIODevice::Text);
+
+ fout = new gpsbabel::XmlStreamWriter(ofile);
+ fout->setAutoFormatting(true);
+ fout->setAutoFormattingIndent(2);
osm_init_icons();
waypoints.clear();
void
OsmFormat::write()
{
- gbfprintf(fout, "<?xml version='1.0' encoding='UTF-8'?>\n");
- gbfprintf(fout, "<osm version='0.6' generator='GPSBabel");
+ fout->writeStartDocument();
+ fout->writeStartElement(QStringLiteral("osm"));
+ fout->writeAttribute(QStringLiteral("version"), QStringLiteral("0.6"));
+ QString value(QStringLiteral("GPSBabel"));
if (!gpsbabel_testmode()) {
- gbfprintf(fout, "-%s", gpsbabel_version);
+ value += '-';
+ value += gpsbabel_version;
}
- gbfprintf(fout, "'>\n");
+ fout->writeAttribute(QStringLiteral("generator"), value);
auto osm_waypt_disp_lambda = [this](const Waypoint* waypointp)->void {
osm_waypt_disp(waypointp);
route_disp_all(osm_rte_disp_head_lambda, osm_rte_disp_trail_lambda, osm_rtept_disp_lambda);
track_disp_all(osm_rte_disp_head_lambda, osm_rte_disp_trail_lambda, osm_rtept_disp_lambda);
- gbfprintf(fout, "</osm>\n");
+ fout->writeEndElement(); // osm
}
void
OsmFormat::wr_deinit()
{
- gbfclose(fout);
+ fout->writeEndDocument();
+ delete fout;
+ fout = nullptr;
+ ofile->close();
+ delete ofile;
+ ofile = nullptr;
waypt_disp_all(osm_release_ids);
route_disp_all(nullptr, nullptr, osm_release_ids);
#ifndef OSM_H_INCLUDED_
#define OSM_H_INCLUDED_
-#include <QHash> // for QHash
-#include <QList> // for QList
-#include <QPair> // for QPair
-#include <QString> // for QString
-#include <QVector> // for QVector
-#include <QXmlStreamAttributes> // for QXmlStreamAttributes
+#include <QHash> // for QHash
+#include <QList> // for QList
+#include <QPair> // for QPair
+#include <QString> // for QString
+#include <QVector> // for QVector
+#include <QXmlStreamAttributes> // for QXmlStreamAttributes
#include "defs.h"
-#include "format.h" // for Format
-#include "gbfile.h" // for gbfile
-#include "xmlgeneric.h" // for xg_functor_map_entry, cb_start, cb_end, xg_string
+#include "format.h" // for Format
+#include "src/core/file.h" // for File
+#include "src/core/xmlstreamwriter.h" // for XmlStreamWriter
+#include "xmlgeneric.h" // for xg_functor_map_entry, cb_start, cb_end, xg_string
class OsmFormat : public Format
void osm_init_icons();
void osm_write_tag(const QString& key, const QString& value) const;
void osm_disp_feature(const Waypoint* waypoint) const;
- void osm_write_opt_tag(const char* atag);
+ void osm_write_opt_tag(const QString& atag);
static void osm_release_ids(const Waypoint* waypoint);
static QString osm_name_from_wpt(const Waypoint* waypoint);
void osm_waypt_disp(const Waypoint* waypoint);
QHash<QPair<int, QString>, const osm_icon_mapping_t*> values;
QHash<QString, const osm_icon_mapping_t*> icons;
- gbfile* fout{};
+ gpsbabel::File* ofile{nullptr};
+ gpsbabel::XmlStreamWriter* fout{nullptr};
int node_id{};
int skip_rte{};
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<osm version="0.6" generator="GPSBabel">
+ <node id="-1" visible="true" lat="50.9000000" lon="0.1000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 1"/>
+ <tag k="note" v="osm-id 1"/>
+ </node>
+ <node id="-2" visible="true" lat="50.9000000" lon="-0.1000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 2"/>
+ <tag k="note" v="osm-id 2"/>
+ </node>
+ <node id="-3" visible="true" lat="51.1000000" lon="-0.1000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 3"/>
+ <tag k="note" v="osm-id 3"/>
+ </node>
+ <node id="-4" visible="true" lat="51.1000000" lon="0.1000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 4"/>
+ <tag k="note" v="osm-id 4"/>
+ </node>
+ <node id="-5" visible="true" lat="50.8000000" lon="0.0000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 5"/>
+ <tag k="note" v="osm-id 5"/>
+ </node>
+ <node id="-6" visible="true" lat="50.8000000" lon="-0.2000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 6"/>
+ <tag k="note" v="osm-id 6"/>
+ </node>
+ <node id="-7" visible="true" lat="51.0000000" lon="-0.2000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 7"/>
+ <tag k="note" v="osm-id 7"/>
+ </node>
+ <node id="-8" visible="true" lat="51.0000000" lon="0.0000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 8"/>
+ <tag k="note" v="osm-id 8"/>
+ </node>
+ <node id="-9" visible="true" lat="50.7000000" lon="-0.1000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 9"/>
+ <tag k="note" v="osm-id 9"/>
+ </node>
+ <node id="-10" visible="true" lat="50.7000000" lon="-0.3000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 10"/>
+ <tag k="note" v="osm-id 10"/>
+ </node>
+ <node id="-11" visible="true" lat="50.9000000" lon="-0.3000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 11"/>
+ <tag k="note" v="osm-id 11"/>
+ </node>
+ <node id="-12" visible="true" lat="50.9000000" lon="-0.1000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 12"/>
+ <tag k="note" v="osm-id 12"/>
+ </node>
+ <node id="-13" visible="true" lat="50.6000000" lon="-0.2000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 13"/>
+ <tag k="note" v="osm-id 13"/>
+ </node>
+ <node id="-14" visible="true" lat="50.6000000" lon="-0.4000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 14"/>
+ <tag k="note" v="osm-id 14"/>
+ </node>
+ <node id="-15" visible="true" lat="50.8000000" lon="-0.4000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 15"/>
+ <tag k="note" v="osm-id 15"/>
+ </node>
+ <node id="-16" visible="true" lat="50.8000000" lon="-0.2000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 16"/>
+ <tag k="note" v="osm-id 16"/>
+ </node>
+ <node id="-17" visible="true" lat="51.0000000" lon="0.0000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Restuarant"/>
+ <tag k="note" v="My Restuarant"/>
+ <tag k="amenity" v="restaurant"/>
+ </node>
+ <node id="-18" visible="true" lat="50.8000000" lon="-0.2000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Pub"/>
+ <tag k="note" v="My Local Pub"/>
+ <tag k="amenity" v="nightclub"/>
+ </node>
+ <node id="-19" visible="true" lat="50.7000000" lon="-0.3000000">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Store"/>
+ <tag k="note" v="My Local Store; Sells Food"/>
+ <tag k="shop" v="convenience"/>
+ </node>
+ <way id="-20" visible="true">
+ <nd ref="-1"/>
+ <nd ref="-2"/>
+ <nd ref="-3"/>
+ <nd ref="-4"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Restuarant"/>
+ <tag k="note" v="osm-id 1"/>
+ </way>
+ <way id="-21" visible="true">
+ <nd ref="-5"/>
+ <nd ref="-6"/>
+ <nd ref="-7"/>
+ <nd ref="-8"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Pub"/>
+ <tag k="note" v="osm-id 2"/>
+ </way>
+ <way id="-22" visible="true">
+ <nd ref="-9"/>
+ <nd ref="-10"/>
+ <nd ref="-11"/>
+ <nd ref="-12"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Pub"/>
+ <tag k="note" v="osm-id 3"/>
+ </way>
+ <way id="-23" visible="true">
+ <nd ref="-13"/>
+ <nd ref="-14"/>
+ <nd ref="-15"/>
+ <nd ref="-16"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="My Store"/>
+ <tag k="note" v="osm-id 3"/>
+ </way>
+</osm>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<osm version="0.6" generator="GPSBabel">
+ <node id="-1" visible="true" lat="48.1421982" lon="11.5412243" timestamp="2008-03-06T19:16:18Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 250870628"/>
+ <tag k="note" v="osm-id 250870628"/>
+ </node>
+ <node id="-2" visible="true" lat="48.1449059" lon="11.5411711" timestamp="2006-12-14T23:22:36Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21585826"/>
+ <tag k="note" v="osm-id 21585826"/>
+ </node>
+ <node id="-3" visible="true" lat="48.1444666" lon="11.5407244" timestamp="2006-12-29T14:41:35Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21585827"/>
+ <tag k="note" v="osm-id 21585827"/>
+ </node>
+ <node id="-4" visible="true" lat="48.1448788" lon="11.5426666" timestamp="2006-11-30T14:20:49Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21324374"/>
+ <tag k="note" v="osm-id 21324374"/>
+ </node>
+ <node id="-5" visible="true" lat="48.1463562" lon="11.5357400" timestamp="2008-02-10T13:05:27Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 245339"/>
+ <tag k="note" v="osm-id 245339"/>
+ </node>
+ <node id="-6" visible="true" lat="48.1462960" lon="11.5363118" timestamp="2008-02-10T13:05:27Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 245353"/>
+ <tag k="note" v="osm-id 245353"/>
+ </node>
+ <node id="-7" visible="true" lat="48.1452410" lon="11.5415523" timestamp="2007-02-07T16:49:43Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 398692"/>
+ <tag k="note" v="osm-id 398692"/>
+ </node>
+ <node id="-8" visible="true" lat="48.1452209" lon="11.5408870" timestamp="2006-12-18T10:06:05Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 398694"/>
+ <tag k="note" v="osm-id 398694"/>
+ </node>
+ <node id="-9" visible="true" lat="48.1453234" lon="11.5405037" timestamp="2006-12-18T10:06:05Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 398704"/>
+ <tag k="note" v="osm-id 398704"/>
+ </node>
+ <node id="-10" visible="true" lat="48.1457468" lon="11.5386711" timestamp="2006-12-18T10:07:09Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 398705"/>
+ <tag k="note" v="osm-id 398705"/>
+ </node>
+ <node id="-11" visible="true" lat="48.1462259" lon="11.5369775" timestamp="2006-08-28T22:19:19Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 398710"/>
+ <tag k="note" v="osm-id 398710"/>
+ </node>
+ <node id="-12" visible="true" lat="48.1442413" lon="11.5454470" timestamp="2006-10-24T12:41:23Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 19404292"/>
+ <tag k="note" v="osm-id 19404292"/>
+ </node>
+ <node id="-13" visible="true" lat="48.1461044" lon="11.5369041" timestamp="2006-11-17T12:37:19Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21040287"/>
+ <tag k="note" v="osm-id 21040287"/>
+ </node>
+ <node id="-14" visible="true" lat="48.1462212" lon="11.5356144" timestamp="2008-02-10T13:05:37Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21040288"/>
+ <tag k="note" v="osm-id 21040288"/>
+ </node>
+ <node id="-15" visible="true" lat="48.1461793" lon="11.5362042" timestamp="2008-02-10T13:05:36Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21040289"/>
+ <tag k="note" v="osm-id 21040289"/>
+ </node>
+ <node id="-16" visible="true" lat="48.1459432" lon="11.5377728" timestamp="2006-12-18T10:06:05Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21040291"/>
+ <tag k="note" v="osm-id 21040291"/>
+ </node>
+ <node id="-17" visible="true" lat="48.1462657" lon="11.5365998" timestamp="2008-02-10T13:05:26Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21040296"/>
+ <tag k="note" v="osm-id 21040296"/>
+ </node>
+ <node id="-18" visible="true" lat="48.1439353" lon="11.5467331" timestamp="2006-11-30T14:20:49Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21324375"/>
+ <tag k="note" v="osm-id 21324375"/>
+ </node>
+ <node id="-19" visible="true" lat="48.1451471" lon="11.5418860" timestamp="2006-12-18T10:06:06Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21324376"/>
+ <tag k="note" v="osm-id 21324376"/>
+ </node>
+ <node id="-20" visible="true" lat="48.1453506" lon="11.5409376" timestamp="2006-12-18T10:06:04Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21324380"/>
+ <tag k="note" v="osm-id 21324380"/>
+ </node>
+ <node id="-21" visible="true" lat="48.1454507" lon="11.5405629" timestamp="2006-12-18T10:06:07Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21324381"/>
+ <tag k="note" v="osm-id 21324381"/>
+ </node>
+ <node id="-22" visible="true" lat="48.1459135" lon="11.5386510" timestamp="2006-12-18T10:06:04Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21324382"/>
+ <tag k="note" v="osm-id 21324382"/>
+ </node>
+ <node id="-23" visible="true" lat="48.1447078" lon="11.5384168" timestamp="2007-06-27T18:34:56Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21585828"/>
+ <tag k="note" v="osm-id 21585828"/>
+ </node>
+ <node id="-24" visible="true" lat="48.1451206" lon="11.5414087" timestamp="2006-12-18T10:06:01Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21632176"/>
+ <tag k="note" v="osm-id 21632176"/>
+ </node>
+ <node id="-25" visible="true" lat="48.1439747" lon="11.5453262" timestamp="2007-06-27T18:34:56Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 21632177"/>
+ <tag k="note" v="osm-id 21632177"/>
+ </node>
+ <node id="-26" visible="true" lat="48.1423259" lon="11.5327741" timestamp="2008-03-06T19:16:17Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 250870622"/>
+ <tag k="note" v="osm-id 250870622"/>
+ </node>
+ <node id="-27" visible="true" lat="48.1423839" lon="11.5358031" timestamp="2008-03-06T19:16:17Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 250870624"/>
+ <tag k="note" v="osm-id 250870624"/>
+ </node>
+ <node id="-28" visible="true" lat="48.1423608" lon="11.5384055" timestamp="2008-03-06T19:16:17Z">
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="osm-id 250870626"/>
+ <tag k="note" v="osm-id 250870626"/>
+ </node>
+ <way id="-29" visible="true">
+ <nd ref="-4"/>
+ <nd ref="-19"/>
+ <nd ref="-7"/>
+ <nd ref="-20"/>
+ <nd ref="-21"/>
+ <nd ref="-22"/>
+ <nd ref="-11"/>
+ <nd ref="-17"/>
+ <nd ref="-6"/>
+ <nd ref="-5"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="Arnulfstraße"/>
+ <tag k="note" v="osm-id 4020271"/>
+ </way>
+ <way id="-30" visible="true">
+ <nd ref="-4"/>
+ <nd ref="-12"/>
+ <nd ref="-18"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="Arnulfstraße"/>
+ <tag k="note" v="osm-id 4020916"/>
+ </way>
+ <way id="-31" visible="true">
+ <nd ref="-7"/>
+ <nd ref="-24"/>
+ <nd ref="-2"/>
+ <nd ref="-3"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="Helmholtzstraße"/>
+ <tag k="note" v="osm-id 4078867"/>
+ </way>
+ <way id="-32" visible="true">
+ <nd ref="-25"/>
+ <nd ref="-3"/>
+ <nd ref="-23"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="Marlene-Dietrich-Straße"/>
+ <tag k="note" v="osm-id 4078868"/>
+ </way>
+ <way id="-33" visible="true">
+ <nd ref="-14"/>
+ <nd ref="-15"/>
+ <nd ref="-13"/>
+ <nd ref="-16"/>
+ <nd ref="-10"/>
+ <nd ref="-9"/>
+ <nd ref="-8"/>
+ <nd ref="-24"/>
+ <nd ref="-4"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="Arnulfstraße"/>
+ <tag k="note" v="osm-id 4513917"/>
+ </way>
+ <way id="-34" visible="true">
+ <nd ref="-26"/>
+ <nd ref="-27"/>
+ <nd ref="-28"/>
+ <nd ref="-1"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="S7"/>
+ <tag k="note" v="osm-id 23197114"/>
+ </way>
+</osm>
--- /dev/null
+No,Name,Latitude,Longitude,Altitude,Speed,Course,HDOP,VDOP,Satellites,Fix,Date,Time\r
+1,"TPT000""",40.741192,-88.737399,225.0,29.25,359.0,0.88,1.50,11,2d,2009/07/06,15:14:11\r
+2,TPT001&,40.741454,-88.737408,225.0,29.25,358.6,0.88,1.50,11,3d,2009/07/06,15:14:12\r
+3,TPT002',40.741717,-88.737415,226.0,29.23,358.7,0.88,1.50,11,dgps,2009/07/06,15:14:13\r
+4,TPT003<,40.741978,-88.737423,226.0,29.23,358.7,0.88,1.50,11,pps,2009/07/06,15:14:14\r
+5,TPT004>,40.742238,-88.737431,226.0,29.20,358.7,0.88,1.50,11,none,2009/07/06,15:14:15\r
+6,TPT005,40.742500,-88.737439,226.0,29.23,358.6,0.88,1.50,11,2d,2009/07/06,15:14:16\r
+7,TPT006,40.742763,-88.737447,226.0,29.23,358.7,0.88,1.50,11,2d,2009/07/06,15:14:17\r
+8,TPT007,40.743024,-88.737453,226.0,29.25,358.8,0.88,1.50,11,2d,2009/07/06,15:14:18\r
+9,TPT008,40.743286,-88.737461,226.0,29.25,358.8,0.88,1.50,11,2d,2009/07/06,15:14:19\r
+10,TPT009,40.743548,-88.737467,227.0,29.25,358.7,0.88,1.50,11,2d,2009/07/06,15:14:20\r
+11,TPT010,40.743810,-88.737475,227.0,29.28,358.9,0.88,1.50,11,2d,2009/07/06,15:14:21\r
+12,TPT011,40.744072,-88.737479,227.0,29.28,359.2,0.88,1.50,11,2d,2009/07/06,15:14:22\r
+13,TPT012,40.744334,-88.737484,227.0,29.28,359.2,0.88,1.50,11,2d,2009/07/06,15:14:23\r
+14,TPT013,40.744596,-88.737489,227.0,29.25,359.1,0.88,1.50,11,2d,2009/07/06,15:14:24\r
+15,TPT014,40.744858,-88.737495,227.0,29.23,359.0,0.88,1.50,11,2d,2009/07/06,15:14:25\r
+16,TPT015,40.745120,-88.737500,227.0,29.28,359.1,0.88,1.50,11,2d,2009/07/06,15:14:26\r
+17,TPT016,40.745383,-88.737503,227.0,29.36,359.5,0.88,1.50,11,2d,2009/07/06,15:14:27\r
+18,TPT017,40.745647,-88.737502,227.0,29.39,0.3,0.88,1.50,11,2d,2009/07/06,15:14:28\r
+19,TPT018,40.745909,-88.737491,227.0,29.36,1.9,0.88,1.50,11,2d,2009/07/06,15:14:29\r
+20,TPT019,40.746172,-88.737470,227.0,29.36,3.5,0.88,1.50,11,2d,2009/07/06,15:14:30\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<osm version="0.6" generator="GPSBabel">
+ <node id="-1" visible="true" lat="40.7411920" lon="-88.7373990" timestamp="2009-07-06T15:14:11Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT000""/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-2" visible="true" lat="40.7414540" lon="-88.7374080" timestamp="2009-07-06T15:14:12Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="3d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT001&"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-3" visible="true" lat="40.7417170" lon="-88.7374150" timestamp="2009-07-06T15:14:13Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="dgps"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT002'"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-4" visible="true" lat="40.7419780" lon="-88.7374230" timestamp="2009-07-06T15:14:14Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="pps"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT003<"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-5" visible="true" lat="40.7422380" lon="-88.7374310" timestamp="2009-07-06T15:14:15Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="none"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT004>"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-6" visible="true" lat="40.7425000" lon="-88.7374390" timestamp="2009-07-06T15:14:16Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT005"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-7" visible="true" lat="40.7427630" lon="-88.7374470" timestamp="2009-07-06T15:14:17Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT006"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-8" visible="true" lat="40.7430240" lon="-88.7374530" timestamp="2009-07-06T15:14:18Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT007"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-9" visible="true" lat="40.7432860" lon="-88.7374610" timestamp="2009-07-06T15:14:19Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT008"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-10" visible="true" lat="40.7435480" lon="-88.7374670" timestamp="2009-07-06T15:14:20Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT009"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-11" visible="true" lat="40.7438100" lon="-88.7374750" timestamp="2009-07-06T15:14:21Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT010"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-12" visible="true" lat="40.7440720" lon="-88.7374790" timestamp="2009-07-06T15:14:22Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT011"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-13" visible="true" lat="40.7443340" lon="-88.7374840" timestamp="2009-07-06T15:14:23Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT012"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-14" visible="true" lat="40.7445960" lon="-88.7374890" timestamp="2009-07-06T15:14:24Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT013"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-15" visible="true" lat="40.7448580" lon="-88.7374950" timestamp="2009-07-06T15:14:25Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT014"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-16" visible="true" lat="40.7451200" lon="-88.7375000" timestamp="2009-07-06T15:14:26Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT015"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-17" visible="true" lat="40.7453830" lon="-88.7375030" timestamp="2009-07-06T15:14:27Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT016"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-18" visible="true" lat="40.7456470" lon="-88.7375020" timestamp="2009-07-06T15:14:28Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT017"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-19" visible="true" lat="40.7459090" lon="-88.7374910" timestamp="2009-07-06T15:14:29Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT018"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <node id="-20" visible="true" lat="40.7461720" lon="-88.7374700" timestamp="2009-07-06T15:14:30Z">
+ <tag k="gps:hdop" v="0.880000"/>
+ <tag k="gps:vdop" v="1.500000"/>
+ <tag k="gps:sat" v="11"/>
+ <tag k="gps:fix" v="2d"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="name" v="TPT019"/>
+ <tag k="amenity" v="pub"/>
+ <tag k="building" v="yes"/>
+ </node>
+ <way id="-21" visible="true">
+ <nd ref="-1"/>
+ <nd ref="-2"/>
+ <nd ref="-3"/>
+ <nd ref="-4"/>
+ <nd ref="-5"/>
+ <nd ref="-6"/>
+ <nd ref="-7"/>
+ <nd ref="-8"/>
+ <nd ref="-9"/>
+ <nd ref="-10"/>
+ <nd ref="-11"/>
+ <nd ref="-12"/>
+ <nd ref="-13"/>
+ <nd ref="-14"/>
+ <nd ref="-15"/>
+ <nd ref="-16"/>
+ <nd ref="-17"/>
+ <nd ref="-18"/>
+ <nd ref="-19"/>
+ <nd ref="-20"/>
+ <tag k="created_by" v="GPSBabel"/>
+ <tag k="highway" v="motorway"/>
+ </way>
+</osm>
rm -f ${TMPDIR}/osm-*
gpsbabel -i osm -f ${REFERENCE}/osm-data.xml -o gpx -F ${TMPDIR}/osm-data.gpx -o osm -F ${TMPDIR}/osm-out.xml
compare ${REFERENCE}/osm-data.gpx ${TMPDIR}/osm-data.gpx
+compare ${REFERENCE}/osm-out.xml ${TMPDIR}/osm-out.xml
gpsbabel -i osm -f ${REFERENCE}/osm-center-data.xml -o gpx -F ${TMPDIR}/osm-center-data.gpx -o osm -F ${TMPDIR}/osm-center-out.xml
compare ${REFERENCE}/osm-center-data.gpx ${TMPDIR}/osm-center-data.gpx
+compare ${REFERENCE}/osm-center-out.xml ${TMPDIR}/osm-center-out.xml
# FIXME: implement a test for OSM writer, if possible.
# compare ${REFERENCE}/osm-data.xml ${TMPDIR}/osm-out.xml
+
+# OK, we can't compare our output to osm generated reference files, but at least make sure we produce consistent output
+gpsbabel -t -i unicsv,utc=0 -f ${REFERENCE}/osm_writer.csv -o osm,tagnd="amenity:pub;building:yes",tag="highway:motorway" -F ${TMPDIR}/osm_writer.xml
+compare ${REFERENCE}/osm_writer.xml ${TMPDIR}/osm_writer.xml
+
* Public callers for the above to hide the absence of &apos from HTML
*/
-QString xml_entitize(const QString& str)
+[[deprecated("Use xmlstreamwriter.")]] QString xml_entitize(const QString& str)
{
return entitize(CSTR(str), false);
}